package org.ctstudio.oa.duty.bean;

import java.time.Duration;

public class DutySummary implements UidBean {
  private String uid;
  private long second;
  private long dayCount;

  public void setUid(String uid) {
    this.uid = uid;
  }

  public String getUid() {
    return this.uid;
  }

  public long getSecond() {
    return second;
  }

  public void setSecond(long second) {
    this.second = second;
  }

  public String getTime() {
    Duration d = Duration.ofSeconds(second);
    StringBuilder sb = new StringBuilder();
    long t;
    if ((t = d.toHours()) != 0) {
      sb.append(t).append("小时");
      d = d.minusHours(t);
    }
    if ((t = d.toMinutes()) != 0) {
      sb.append(sb.length() > 0 ? Math.abs(t) : t).append("分钟");
    }
    return sb.toString();
    // return Duration.ofSeconds(second).toString().replace("PT",
    // "").replace("H", "小时").replace("M", "分").replace("S", "秒");
  }

  public long getDayCount() {
    return dayCount;
  }

  public void setDayCount(long dayCount) {
    this.dayCount = dayCount;
  }
}
